package org.smr.ministore.micro;

import java.util.List;

import org.blade.dao.base.BaseMapper;
import org.blade.utils.IdGenUtils;
import org.smr.ministore.dao.GoodsSpecificationGroupOrganMapper;
import org.smr.ministore.entities.GoodsSpecificationGroupOrgan;
import org.smr.ministore.entities.vo.Assign2OrgansVO;
import org.smr.ministore.service.GoodsSpecificationGroupOrganService;
import org.blade.service.base.AbstractService;

import org.blade.utils.Pager;
import org.smr.ministore.service.impl.GoodsSpecificationGroupOrganFacade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController
public class GoodsSpecificationGroupOrganMicroService extends AbstractService<Long, GoodsSpecificationGroupOrgan> implements GoodsSpecificationGroupOrganService {

    @Resource(name = "goodsSpecificationGroupOrganFacade")
    private GoodsSpecificationGroupOrganFacade service;

    @Autowired
    public GoodsSpecificationGroupOrganMicroService(GoodsSpecificationGroupOrganMapper mapper) {
        super(mapper);
    }

    @ResponseBody
    @RequestMapping(method = RequestMethod.POST, value = "/GoodsSpecificationGroupOrgan/batchSave")
    public int batchSave(@RequestBody List<GoodsSpecificationGroupOrgan> entities) {
        return service.batchSave(entities);
    }

    @ResponseBody
    @RequestMapping(method = RequestMethod.POST, value = "/GoodsSpecificationGroupOrgan/batchModify")
    public int batchModify(List<GoodsSpecificationGroupOrgan> entities) {
        return service.batchModify(entities);
    }


    @ResponseBody
    @RequestMapping(method = RequestMethod.PUT, value = "/GoodsSpecificationGroupOrgan/save")
    public int save(@RequestBody GoodsSpecificationGroupOrgan entity) {
        return service.save(entity);
    }

    @ResponseBody
    @RequestMapping(method = RequestMethod.PATCH, value = "/GoodsSpecificationGroupOrgan/updateById")
    public int updateById(@RequestBody GoodsSpecificationGroupOrgan id) {
        return service.updateById(id);
    }

    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/GoodsSpecificationGroupOrgan/queryById/{id}")
    public GoodsSpecificationGroupOrgan queryById(@PathVariable("id") Long id) {
        return (GoodsSpecificationGroupOrgan) service.queryById(id);
    }


    @ResponseBody
    @RequestMapping(method = RequestMethod.DELETE, value = "/GoodsSpecificationGroupOrgan/deleteById/{id}")
    public int deleteById(@PathVariable("id") Long id) {
        return service.deleteById(id);
    }

    @ResponseBody
    @RequestMapping(method = RequestMethod.POST, value = "/GoodsSpecificationGroupOrgan/paginate/{pageSize}/{pageNum}")
    public Pager<GoodsSpecificationGroupOrgan> paginate(GoodsSpecificationGroupOrgan entity, @PathVariable("pageSize") Long pageSize, @PathVariable("pageNum") Long pageNum) {

        return this.service.paginate(entity, pageSize, pageNum);
    }


    @ResponseBody
    @RequestMapping(method = RequestMethod.POST, value = "/GoodsSpecificationGroupOrgan/selectBy")
    public List<GoodsSpecificationGroupOrgan> selectBy(@RequestBody Assign2OrgansVO assignee) {
        return this.service.selectBy(assignee);
    }

    @ResponseBody
    @RequestMapping(method = RequestMethod.DELETE, value = "/GoodsSpecificationGroupOrgan/deleteByIdLogical/{id}")
    public int deleteByIdLogical(@PathVariable("id") Long id) {
        return this.service.deleteByIdLogical(id);
    }

    @Override
    public Long getId() {
        return IdGenUtils.getNextLongId();
    }
}
